package reflect;


import reflect.annotations.AutoRunClass;

import java.io.File;


public class Test3 {
    public static void main(String[] args) throws Exception {
        File dir=new File(
                Test3.class.getResource(".").toURI()
        );
        File[] subs=dir.listFiles(f -> f.getName().endsWith(".class"));
        for (File file:subs){
            String className = file.getName().replace(".class","");
            Class cls = Class.forName(Test3.class.getPackage().getName()+"."+className);
            if (cls.isAnnotationPresent(AutoRunClass.class)){
                Object obj=cls.newInstance();
                System.out.println(obj);
            }
        }
    }
}
